import { applyDecorators, Type } from '@nestjs/common';
import { ApiResponse, ApiProperty } from '@nestjs/swagger';

export const ApiResponseDecorator = <TModel extends Type<any>>(model: TModel) => {
  return applyDecorators(
    ApiResponse({
      status: 200,
      description: '请求成功',
      type: model,
    }),
    ApiResponse({
      status: 400,
      description: '请求参数错误',
    }),
    ApiResponse({
      status: 500,
      description: '服务器错误',
    }),
  );
};